home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mc51bugs / q32774 < prev    next >
Text File  |  1988-07-20  |  1KB  |  49 lines

  1. Q32774 Incorrect Code for Loop with Longs
  2. C Compiler
  3. 5.10   | 5.10
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.    The code generated for the following example is incorrect. The code
  8. generated for the commented line below is assuming that the variable
  9. nline is equal to the variable curlin and the code for the statement:
  10.  
  11.    *(lines+nline) = nxtchr++;
  12.  
  13. is evaluated as:
  14.  
  15.    *(lines+curlin)= nxtchr++;
  16.  
  17.    Microsoft has confirmed this to be a problem in Version 5.10 of the
  18. C compiler. We are researching this problem and will post new
  19. information as it becomes available.
  20.  
  21.  
  22. More information:
  23.    The code to reproduce the problem is as follows:
  24.  
  25. long nxtchr, *lines;
  26. int curlin;
  27. int dummy;
  28.  
  29. void main() {
  30.     int to;
  31.     int nline;
  32.  
  33.     lines = &dummy;
  34.     nline = curlin;
  35.     curlin = to + 1;
  36.  
  37. /* loop optimizer acts as though nline still equals curlin */
  38.  
  39.     for ( ; nline < curlin ; ++nline) {
  40.         *(lines+nline) = nxtchr++;   /* generates code for *(lines+curlin) */
  41.     }
  42. printf("nxtchr %d, lines %d, curlin %d, to %d, nline %d\n"
  43. ,nxtchr,lines,curlin,t o,nline);
  44. }
  45.  
  46.  
  47. Keywords:  buglist5.10 qfbv
  48. Updated  88/07/21 03:19
  49.